import request from '@/utils/request'

export function getBatchList(data) {
    return request({
        url: '/batches',
        method: 'get',
        params: data
    })
}

export function createBatch(data) {
    return request({
        url: '/batches/create',
        method: 'post',
        data
    })
}

export function downloadBatch(data) {
    return request({
        url: '/batches/downloadBatches',
        method: 'post',
        responseType: 'blob',
        data
    })
}

export function downloadBatchHost(data) {
    return request({
        url: '/batches/downloadHost',
        method: 'post',
        responseType: 'blob',
        data
    })
}

export function markBatch(data) {
    return request({
        url: '/batches/mark',
        method: 'post',
        data
    })
}

export function deleteBatch(data) {
    return request({
        url: '/batches/delete',
        method: 'delete',
        data
    })
}

export function getBatchHosts(data) {
    return request({
        url: '/batches/ipList',
        method: 'get',
        params: data
    })
}

export function getBatch({id, ...data}) {
    return request({
        url: `/batches/${id}`,
        method: 'get',
        params: data
    })
}

export function markBatchByLog(data) {
    return request({
        url: '/batches/log',
        method: 'post',
        data
    })
}